package com.iot.server.common.aspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

/**
 * @author wuzt
 * Date 2019/11/22 16:06
 * Version 1.0
 * @ClassName LogAspect
 * Description
 **/
//@Component
//@Aspect
public class LogAspect {
    @Pointcut("execution(* com.iot.server.controller.LoginController.*(..))")
    public void logPointCut() {
    }

    @Before("logPointCut()")
    public void beforePointCut() {
        System.out.println("***********before***********");
    }

    @After("logPointCut()")
    public void afterPointCut() {
        System.out.println("***********after************");
    }

    @Around("logPointCut()")
    public Object aroundPointCut(ProceedingJoinPoint proceedingJoinPoint) {
        try {
            proceedingJoinPoint.proceed();
            System.out.println("*************around*************");
        } catch (Throwable throwable) {
            throwable.printStackTrace();
        }
        return null;
    }
}
